package com.mitaotao._1_语法._4_循环.单循环;

import java.util.Scanner;

public class _06_分解质因数 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入正整数，为您分解质因数：");
        int n = scanner.nextInt();
        System.out.print(n+"=");
        //排除最小质数k=1
        for (int k=2;n>=k;k++){
            //n可被k整除
            if (n%k==0){
                //最大质数n本身，打印
                if (n==k){
                    System.out.println(k);
                }
                //
                else {
                    System.out.print(k + "*");
                }
                //n可被k整除，将n/k的商赋值给n
                n=n/k;
                k++;
            }
        }
        scanner.close();
    }
}
